<template>
	<view>
		<view class="bartop"></view>
		<view class="cu-bar">
			<view class="action">
				<text class="cuIcon-back text-gray" @tap="goBack"></text> 返回
			</view>
			<view class="text-lg text-bold">
				{{item.todayDate}}{{item.classesName}}{{item.operatorCount}}人-{{item.directorName}}
			</view>
			<view class="action">
				<text class="text-lg" style="color: #13227a;" @tap="downLoadStatistics">下载</text>
			</view>
		</view>
		<uni-table border stripe emptyText="暂无更多数据">

			<uni-tr>
				<uni-th width="150" align="center">机台</uni-th>
				<uni-th width="150" align="center">合同号</uni-th>
				<uni-th width="230" align="center">半成品名称</uni-th>
				<uni-th width="150" align="center">合格数量</uni-th>
				<uni-th width="150" align="center">残品量</uni-th>
				<uni-th width="150" align="center">换模时间</uni-th>
				<uni-th width="150" align="center">烘料时间</uni-th>
				<uni-th width="150" align="center">异常停机时间</uni-th>
				<uni-th width="150" align="center">生产时间</uni-th>
				<uni-th width="150" align="center">模数</uni-th>
			</uni-tr>
			<uni-tr v-for="(item, index) in statisticsDetailList" :key="index">
				<uni-td align="center">{{ item.number }}</uni-td>
				<uni-td align="center">{{ item.orderId }}</uni-td>
				<uni-td align="center">{{item.materialName}}-{{item.productName}}-{{item.colourName}}</uni-td>
				<uni-td align="center">{{ item.qualifiedQuantity }}</uni-td>
				<uni-td align="center">{{ item.scrappedPart }}</uni-td>
				<uni-td align="center">{{ item.changeMaterialTime }}</uni-td>
				<uni-td align="center">{{ item.debuggingTime }}</uni-td>
				<uni-td align="center">{{ item.abnormalTime }}</uni-td>
				<uni-td align="center">{{ item.workingHours }}</uni-td>
				<uni-td align="center">{{ item.qualifiedQuantity * item.modulus}}</uni-td>

			</uni-tr>
		</uni-table>

		</uni-table>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				item: {},
				statisticsDetailList: []
			}
		},
		onLoad(options) {
			if (options.data) {
				let data = JSON.parse(options.data)
				this.item = data
			}
			this.getStatisticsDetail()
		},

		methods: {
			goBack() {
				uni.navigateBack({
					delta: 1
				})
			},
			getStatisticsDetail() {
				this.$Request.get(this.$httpApi.assemble.getStatisticsDetail + "?groupId=" + this.item.groupId +
					"&classes=" +
					this.item.classes).then(res => {
					if (res.code == 200) {
						this.statisticsDetailList = res.data
					}
				})
			},
			downLoadStatistics() {
				let title = this.item.todayDate + this.item.classesName + this.item.operatorCount + "人-" +
					this.item
					.directorName
				this.$Request.get(this.$httpApi.assemble.getExportLink + "?groupId=" + this.item.groupId + "&classes=" +
					this.item.classes + "&text=" + title).then(res => {
					if (res.code == 200) {
						uni.showModal({
							title: '提示',
							content: '下载链接已发送钉钉群',
							success: (res) => {
								if (res.cancel == true) {

								} else {

								}
							}
						})
					}
				})
			}

		}
	}
</script>

<style>

</style>
